import request from "./request.js"
import api from "./interface.js"
import Md5 from "./md5.js"
const myModal = {
  async Login(pa, pageName) {
    pa = {
      ...pa,
    }
    let json = await request.postJson(api.Login, signParam(pa), pageName);
    return json
  }
}
/**
 *  加密参数
 */
 function signParam(param) {
  var array = new Array();
  for (var p in param) {
    if (p != "sign") {
      array.push(p);
    }
  }
  var keys = array.sort();
  //console.log("*********sort",array.sort());
  var signString = secret;
  for (var i = 0; i < keys.length; i++) {
    signString += (keys[i] + param[keys[i]]);
  }
  signString += secret;
  param["sign"] = Md5.hex_md5(signString);
  return param;
}
